package com.bys.util;

import cn.hutool.core.exceptions.UtilException;
import cn.hutool.core.io.IoUtil;
import jakarta.servlet.http.HttpServletResponse;

import java.io.IOException;
import java.io.Writer;

/**
 * 客户端工具类
 *
 */
public class ServletUtil {
    public static void write(HttpServletResponse response, String text, String contentType) {
        response.setContentType(contentType);
        Writer writer = null;

        try {
            writer = response.getWriter();
            writer.write(text);
            writer.flush();
        } catch (IOException var8) {
            throw new UtilException(var8);
        } finally {
            IoUtil.close(writer);
        }

    }


}
